tests: Connect to draw signal in testellipsise
authorBenjamin Otte <otte@redhat.com>
Wed, 8 Sep 2010 20:17:48 +0000 (22:17 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 26 Sep 2010 13:11:40 +0000 (15:11 +0200)
The test seems broken, not sure why.

tests/testellipsise.c

index 102045647951f38d5a439a0242eb49b7531f254f..e4d2b8c9e289f98d0b8b89d83ac23823335d710d 100644 (file)
@@ -64,27 +64,22 @@ scale_changed_cb (GtkRange *range,
 }
 
 static gboolean
-ebox_expose_event_cb (GtkWidget      *widget,
-                      GdkEventExpose *event,
-                      gpointer        data)
+ebox_draw_cb (GtkWidget *widget,
+              cairo_t   *cr,
+              gpointer   data)
 {
   PangoLayout *layout;
   const double dashes[] = { 6, 18 };
-  GtkAllocation allocation, label_allocation;
+  GtkAllocation label_allocation;
   GtkRequisition minimum_size, natural_size;
   GtkWidget *label = data;
-  cairo_t *cr;
   gint x, y;
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
   cairo_translate (cr, -0.5, -0.5);
   cairo_set_line_width (cr, 1);
 
-  gtk_widget_get_allocation (widget, &allocation);
-
   cairo_set_source_rgb (cr, 1, 1, 1);
-  cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
-  cairo_fill (cr);
+  cairo_paint (cr);
 
   gtk_widget_translate_coordinates (label, widget, 0, 0, &x, &y);
   layout = gtk_widget_create_pango_layout (widget, "");
@@ -123,8 +118,6 @@ ebox_expose_event_cb (GtkWidget      *widget,
   cairo_set_dash (cr, dashes, 2, 12.5);
   cairo_stroke (cr);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 
@@ -169,7 +162,7 @@ main (int argc, char *argv[])
 
   g_signal_connect (combo, "changed", G_CALLBACK (combo_changed_cb), label);
   g_signal_connect (scale, "value-changed", G_CALLBACK (scale_changed_cb), label);
-  g_signal_connect (ebox, "expose-event", G_CALLBACK (ebox_expose_event_cb), label);
+  g_signal_connect (ebox, "draw", G_CALLBACK (ebox_draw_cb), label);
 
   gtk_widget_show_all (window);